package com.zhentao.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhentao.common.dtos.ResponseResult;
import com.zhentao.common.enums.AppHttpCodeEnum;
import com.zhentao.constants.UserThreadLocal;
import com.zhentao.follow.domain.AppUserFollow;
import com.zhentao.service.AppUserFollowService;
import com.zhentao.service.AppUserService;
import com.zhentao.service.UserSaveService;
import com.zhentao.user.domain.AppUser;
import com.zhentao.user.dto.IdDto;
import com.zhentao.user.dto.UserInfoSaveDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/api/wx/user")
public class UserTokenController {

    @Autowired
    private UserSaveService userSaveService;

    @Autowired
    private AppUserService appUserService;

    /**
     *
     * 用户详情完善
     * @param dto
     * @return
     */
    @PostMapping("/saveUserInfo")
    public ResponseResult saveUserInfo(@RequestBody UserInfoSaveDto dto){
        return userSaveService.saveUserInfo(dto);
    }

    /**
     * 个人用户详情
     * @param openId
     * @return
     */
    @GetMapping("/auth/getUserInfo")
    public ResponseResult getUserInfo(@RequestParam("openId") String openId){
        return userSaveService.getUserInfo(openId);
    }

    /**
     * 关注
     * @param id
     * @return
     */

    @GetMapping("/auth/guanzhu")
    public ResponseResult forgetUserInfo(@RequestParam("id")Integer id,@RequestParam("options")Integer options){
        return userSaveService.forgetUserInfo(id,options);
    }

    /**
     * 关注列表
     * @return
     */
    @GetMapping("/auth/listGuanzhu")
    public ResponseResult listGuanzhu(){
        return appUserService.listGuanzhu();
    }

    /**
     * 实名认证
     */
    @PostMapping("/auth/Idcard")
    public ResponseResult Idcard(@RequestBody IdDto dto){
        return appUserService.Idcard(dto);
    }

}
